class Solution {
public:
    void _binaryTreePaths(TreeNode* root, string s, vector<string>& vs)
    {
        if(root == nullptr)
            return;
        
        if(root->left == nullptr && root->right == nullptr)
        {
            vs.push_back(s + to_string(root->val));
            return;
        }

        _binaryTreePaths(root->left, s + to_string(root->val) + "->", vs);
        _binaryTreePaths(root->right,s + to_string(root->val) + "->", vs);
    }

    vector<string> binaryTreePaths(TreeNode* root) {

        vector<string> vs;
        _binaryTreePaths(root,"",vs);

        return vs;
    }
};